{template "content_1","header"}
<link href="{CSS_PATH}head_nobg.css" rel="stylesheet" type="text/css" />
<link href="{CSS_PATH}footer.css" rel="stylesheet" type="text/css" />
<link href="{CSS_PATH}map.css" rel="stylesheet" type="text/css" />
<link href="{CSS_PATH}services/AMap.css" rel="stylesheet" type="text/css" />
<script src="http://api.amap.com/webapi/init?v=1.1" type="text/javascript"></script>
<script src="{JS_PATH}services/AMap.js" type="text/javascript"></script>

<div id="map_container">
	<div id="map_breadcrum">
		<a href="{base::load_config('system','web_path')}">首页</a>&gt;
		<a href="{base::load_config('system','service_map_url')}">商家地图</a>
		&gt;		<a href="/map3-0-0">{$html_aAreaPath[0]}</a>
		{if $html_nCityId }
			&gt;
			<a href="/map{$html_nCityId}-0-0">{$html_aAreaPath[1]}</a>
		{/if}
		{if $html_nCommunityId }
			&gt;
			<a href="/map{$html_nCityId}-{$html_nCommunityId}-0">{$html_aAreaPath[2]}</a>
		{/if}
	</div>
	<div id="map_content">
		<div id="map_sidebar">
			<h2>全部地区</h2>
			<ul>
				{loop $html_aShaCity $aD}
					{if $aD['companyNum'] > 0}
						<li><a href="{$aD['url']}">{$aD['area_name']}({$aD['companyNum']})</a></li>
					{/if}
				{/loop}
			</ul>
			<h2>热门社区</h2>
			<ul>
				{if $html_aShaCommunity}
					{loop $html_aShaCommunity $aD}
						{if $aD['area_name'] != '其他' && $aD['companyNum'] > 0 }
							<li><a href="{$aD['url']}">{$aD['area_name']}({$aD['companyNum']})</a></li>
						{/if}
					{/loop}
					{loop $html_aShaCommunity $aD}
						{if $aD['area_name'] == '其他' && $aD['companyNum'] > 0}
							<li><a href="{$aD['url']}">{$aD['area_name']}({$aD['companyNum']})</a></li>
							<?php break; ?>
						{/if}
					{/loop}
				{else}
					<li><a href="javascript:">暂未收录该地区下的社区</a></li>
				{/if}
			</ul> 
			<br class="auto_extend" />
		</div>

		<?php
		$thisUrl = ($html_nCityId == 0) ? '/map3-'.$html_nCommunityId : '/map'.$html_nCityId.'-'.$html_nCommunityId;
		$thisQ = ($_GET['q']) ? '?q='.htmlentities(urlencode($_GET['q'])) : '';
		?>
		
		<div id="map_main_body">		{if $html_aLinkCompany}		<div class="market_list">			<ul>				{loop $html_aLinkCompany $k $aD}				<li class="jsLinkCompany" i="{$aD['member_company_id']}">
					<a href="#"><img width="90" height="60" title="{$aD['company_name']}" alt="{$aD['company_name']}" src="{$aD['logo']}" /></a></li>				{/loop}			</ul>		</div>		{/if}
		
		<div id="map_in_order">
			<ul>
				<li class="current">
					<a href="/maplist{$area}{if $_GET['trading']}-{$_GET['trading']}{else}-0{/if}{if $_GET['order']}-{$_GET['order']}{else}-0{/if}{if $_GET['q']}?q={htmlentities(urlencode($_GET['q']))}{if $_GET['page']}&page={$_GET['page']}{/if}{else}{if $_GET['page']}/page/{$_GET['page']}{/if}{/if}" class="f_blue">
					列表</a>
				</li>
				<li class="f_white">地图</li>
			</ul>
				<p><a href="{$thisUrl}-0{$thisQ}" class="f66">默认排序</a>&nbsp;</p>
				<p class="{if $order == 2}orderlist_desc{else}orderlist{/if}">
					<a href="{$thisUrl}-2{$thisQ}" class="f66">商家加盟时间</a>&nbsp;&nbsp;
				</p>
				<p class="{if $order == 1}orderlist_desc{else}orderlist{/if}">
					<a href="{$thisUrl}-1{$thisQ}" class="f66">车易信用指数</a>
				</p>
                
                
            </div>
            <div id="searchbox">
            	<input type="text" id="searchword" name="searchword"  value="{$_GET['q']}"/>
                <input type="button" id="searchnow" name="searchnow" value="搜索" />
			</div>
        </div>
        	<div id="map">
            	<!-- <img src="{IMG_PATH}business/map_demo.jpg" /> -->
            </div>
			<div id="pages" style="margin-left:10px;">{$sPageCutHtml}</div>
    </div>
    <div class="clear"></div>
</div>

<script type="text/javascript">
$(function(){
	// 检索
	$('#searchnow').click(function(){
		var keyword = $.trim($('#searchword').val());
		location.href = "{$thisUrl}-0?q="+encodeURI(keyword);
	});

	// 默认选中样式
	$('.menu a').removeClass('cur');
	$('.menu a').eq(1).addClass('cur');
	
	// 检索连锁店
	$(".jsLinkCompany").click(function(){
		var keyword = $.trim($('#searchword').val());
		location.href = '/maplink3-0-'+$(this).attr('i');
		return false;
	});
});
</script>
<script type="text/javascript">
$(function(){
	//店铺信息
	var oShopListJs = eval({$html_aShopsDataList});

	//创建和初始化地图函数：
	var area_name = "{$html_aAreaPath[1]}";
	if (area_name == ''){
		area_name = amap_Shanghai_name;
	}
	
	// 地图初始化
	function initialize(){
		var opt = {
			level : amap_privince_level,//设置地图zoom级别
			center : new AMap.LngLat(amap_Shanghai_lng, amap_Shanghai_lat)//设置地图中心点   
		}
		var mapObj = new AMap.Map("map", opt); // 创建地图实例  
		if (area_name != amap_Shanghai_name && area_name != amap_Shanghai_name + '市' ){
			if (area_name == amap_putuo_name){
				mapObj.setCenter(new AMap.LngLat(amap_putuo_lng, amap_putuo_lat));
				mapObj.setZoom(amap_city_level);
			} else {
				mapObj.setCity(area_name, function(){
					var center = mapObj.getCenter();
					mapObj.setCenter(new AMap.LngLat(center.lng, center.lat));
					mapObj.setZoom(amap_city_level);
				});
			}
		}
		
		// 添加插件
		AMap_addPlugin(mapObj);
		
		for(var i in oShopListJs){
			
			var oPointOne = oShopListJs[i];
			
			// 添加点
			var point = new AMap.LngLat(oPointOne.map_longitude / amap_logdeviation, oPointOne.map_latitude / amap_latdeviation);
			var thisPoint = {
				title : oPointOne.shop_name,
				logo : oPointOne.shop_logo,
				address : oPointOne.shop_address,
				point : oPointOne.shop_point,
				url :oPointOne.shop_url
			};
			
			AMap_addPoint(mapObj, point, i, AMap_getPointContent(thisPoint));
		}
	}

	$(function(){
		initialize();
	});
});
</script>
{template "content_1","footer"}
